"""
有100个同学的分数：数据请用随机函数生成；
 A  利用多线程程序（比如，5个线程，每个线程负责输出20条记录），快速输出这100个同学的信息；
 B 利用线程池来实现；
"""
import random
from concurrent.futures import ThreadPoolExecutor
from threading import Thread


def func(start, end):
    for i in range(start, end):
        print(data[i])


if __name__ == '__main__':
    data = []
    for i in range(100):
        data.append(random.randint(0, 100))
    # A
    # for i in range(5):
    #     t = Thread(target=func, args=(i*20,(i+1)*20))
    #     t.start()

#    B
    with ThreadPoolExecutor(10) as t:
        for i in range(5):
            t.submit(func, i, (i+1)*20)





